<?php
namespace app\admin\controller;

use app\admin\model\Sms_code as SmscodeModel;
use app\common\controller\AdminBaseController;
/**
 * 短信验证管理
 * Class Smscode
 * @package app\admin\controller
 */

class SmscodeController extends AdminBaseController {
	
    protected $smscode_model;

    protected function _initialize() {
        parent::_initialize();
        $this->smscode_model = new SmscodeModel();
    }
 //列表
 
 public function index() {
        $list = $this->smscode_model->order('update_time desc')->paginate(15);
     ;
        return $this->fetch('index',['list' => $list]);
    }
    
    
    public function search(){
    	$map = [];
				    	
    	if(request()->isPost()){
		 	$param = input('post.');		
			//用户名称
			if($param['title']){
				$map['title'] = ['like', '%'.$param['title'].'%'];
			}
			//手机号码
			if($param['mobile']){
				$map['mobile'] = ['like', '%'.$param['mobile'].'%'];
			}	
			//时间
			if($param['update_time']){
				$map['update_time'] = ['like', '%'.$param['update_time'].'%'];
			}
			if($param['result']){
				$map['result'] = ['like', '%'.$param['result'].'%'];
			}						
	 	}
	 $list = $this->smscode_model->where($map)->order('update_time desc')->select();
        return $this->fetch('index', ['list' => $list]);
    }
    
    
}